﻿using MediatR;
using RedDragon.Common.Domain.Manufacture;
using RedDragon.Common.Infrastructure.Interface;
using T.Common.Domain.Common;

namespace RedDragon.RBAC.API.Application.Common.ProcessW
{
    public class WorkCentersSerchHandler : IRequestHandler<WorkCentersSerchCommon, Result>
    {
        public readonly IBaseRepository<WorkCenters> WorkCentersRepository;

        public WorkCentersSerchHandler(IBaseRepository<WorkCenters> workCentersRepository)
        {
            WorkCentersRepository = workCentersRepository;
        }

        public async Task<Result> Handle(WorkCentersSerchCommon request, CancellationToken cancellationToken)
        {
            var result = new Result() { Code = 1, Msg = "工作中心数据显示" };
            try
            {
                var list =  WorkCentersRepository.Query().ToList();
                result.Data = list;
            }
            catch (Exception)
            {

                throw;
            }
            return result;
        }
    }
}
